<?php

class OperationFactory
{
    public static function createOperation($type): Operation
    {
        switch ($type) {
            case '+':
                return new OperationAdd();
            case '/':
                return new OperationDiv();
            default:
                throw new Exception('不支持该方法');
        }
    }
}